import axios from 'axios'

const actions = {
	async add({commit}){
		const result = await axios.get('http://api.uixsj.cn/hitokoto/get?type=social')
		commit('ADD',result.data)
	}
}

const mutations = {
	ADD(state,sayingStr){
		state.list.unshift(sayingStr)
	}
}

const state = {
	list:[
		'以后路还长，指不定谁辉煌！'
	]
}

const getters = {
	total(state){
		return state.list.length
	}
}

export default {
	namespaced:true,
	actions,
	mutations,
	state,
	getters
}